package com.zzyl.mapper;

import com.zzyl.dto.UserDto;
import com.zzyl.entity.User;
import com.zzyl.vo.UserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper {

    int deleteByPrimaryKey(Long id);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Long id);

    Integer updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    /**
     * 这是Mybatis Generator拓展插件生成的方法(请勿删除).
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated
     * @author hewei
     */
    int batchInsert(@Param("list") List<User> list);

    List<User> findPage(UserDto userDto);

    Integer insertUser(User user);

    @Update("update sys_user set data_state = #{status} where id = #{id}")
    //本项目两个参数以上的都要加别名，还有集合也需要加别名，SpringBoot和Mybatis有冲突
    void updateStatus(@Param("id") Long id, @Param("status") String status);

    @Update("update sys_user set password = '888itcast.CN764%...' where id = #{userId}")
    Integer resetPassword(Long userId);

    @Select("select * from user")
    List<UserVo> findList();
}